<template>
<div>
     <div id="main2" style="width: 1200px;height:580px;"></div>
<!-- <div v-for="item in TopViewList" :key="item.id">
    {{item.title}}
</div> -->
</div>
</template>

<script>
import * as echarts from 'echarts'
// import _ from 'lodash'
export default {
  props: ['TopTagList', 'VarTagListName', 'VarTagListtopicCount'],
  data () {
    return {
      // name: '',
      // value: '',
      option2: {
        title: {
          text: '标签使用占比',
          subtext: 'Fake Data',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: '使用次数',
            type: 'pie',
            radius: '70%',
            data: [
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' },
              { value: '', name: '' }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 10,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
    }
  },
  methods: {},
  created () {
    console.log(this.VarTagListName)
    console.log(this.VarTagListtopicCount)
    // console.log(JSON.parse(window.localStorage.getItem('VarTagListtopicCount'))[0])
  },
  components: {},
  mounted () {
    // this.option.xAxis.data = JSON.parse(window.localStorage.getItem('xAxisData'))
    // this.option.series[0].data = JSON.parse(window.localStorage.getItem('seriesData'))

    // this.$nextTick(() => {
    for (var i = 0; i <= 9; i++) {
      this.option2.series[0].data[i].value = JSON.parse(window.localStorage.getItem('VarTagListtopicCount'))[i]
      this.option2.series[0].data[i].name = JSON.parse(window.localStorage.getItem('VarTagListName'))[i]
    }
    // })

    var mCharts = echarts.init(document.getElementById('main2'), 'dark')
    mCharts.setOption(this.option2)
  },
  watch: {
  }

}
</script>

<style lang="less" scoped>

</style>
